<!--
 * @Author: luoqi
 * @Date: 2022-04-17 20:44:56
 * @LastEditors: luoqi
 * @LastEditTime: 2022-05-04 10:35:15
 * @Description: 
-->
<template>
  <!-- 收藏疾病视频 -->
  <el-row class="Ctogether">
    <el-col :span="24">
      <p>收藏疾病视频</p>
      <el-row>
        <el-col :span="24">
          <router-link
            :to="{ path: '/main/videodetail', query: { id: item.targetId } }"
            class="video"
            v-for="(item, index) in videoList"
            :key="index"
          >
            <div class="video_img">
              <i class="iconfont icon-24gf-playCircle"></i>
              <img :src="item.imgUrl" alt="" />
            </div>
              <div class="video_header">
                {{ item.title }}
              </div>
            <div class="video_label">
              <el-tag
                type="success"
                class="label"
                v-for="(el, indexs) in item.tag.split(',')"
                :key="indexs + '2'"
                >{{ el }}</el-tag
              >
            </div>
          </router-link>
        </el-col>
      </el-row>
    </el-col>
  </el-row>
</template>

<script>
export default {
  props:['collection'],
  data() {
    return {
      videoList: [],
    };
  },
  watch: {
    collection(newData, old) {
      if (newData) {
        if (this.$route.path == "/main/MyHome/myvideo") {
          this.videoList = this.$store.state.mySelect.videoList;
        } else {
          this.videoList = this.$store.state.herData.collection.videoList;
        }
      }
    },
  },
  created() {
    if (this.$route.path == "/main/MyHome/myvideo") {
      this.videoList = this.$store.state.mySelect.videoList;
    } else {
      this.videoList = this.$store.state.herData.collection.videoList;
    }
  },
};
</script>

<style lang="less" scoped>
@import url("../../less/myhome.less");
</style>